package lab13;

public class Mammal extends Animal {
	private static final int DEFAULT_LEG_NUMBER = 4;
	private int legNumber;

	public int getDefaultLegNumber() {
		return DEFAULT_LEG_NUMBER;
	}
	
	public Mammal() {
		super();
		this.legNumber = getDefaultLegNumber();
	}

	/**
	 * @return the legNumber
	 */
	public int getLegNumber() {
		return legNumber;
	}

	/**
	 * @param legNumber
	 *            the legNumber to set
	 */
	public void setLegNumber(int legNumber) {
		if (legNumber >= 0 && legNumber <= getDefaultLegNumber())
			this.legNumber = legNumber;
	}

	public Mammal(String name, int age, double weight, boolean isDangerous,
			int legNumber) {
		super(name, age, weight, isDangerous);
		this.legNumber = legNumber;

	}

	public Mammal(String name) {
		super(name);
		this.legNumber = getDefaultLegNumber();
		// TODO Auto-generated constructor stub
	}

	protected void walk() {
		System.out.println(getName() + " walking on " + legNumber + " legs.");
	}

	@Override
	public String toString() {
		return "Mamal [name=" + getName() + ", age=" + getAge() + ", weight="
				+ getWeight() + ", isDangerous=" + isDangerous()
				+ ", legNumber=" + legNumber + "]";
	}
}